package collections;

public class TMessage implements Comparable<TMessage>{

    protected Long msid; // 本地消息存储顺序id
    protected Long mid; // 消息id

    public TMessage(Long mid) {
        this.mid = mid;
    }

    public Long getMid() {
        return mid;
    }

    @Override
    public int compareTo(TMessage o) {
        long otherMid = WrapperUtils.toLong(o.getMid());
        long mid = WrapperUtils.toLong(getMid());
        if (otherMid > mid) {
            return -1;
        }

        if (otherMid < mid) {
            return 1;
        }

        return 0;
    }

    @Override
    public String toString() {
        return "TMessage{" +
            "msid=" + msid +
            ", mid=" + mid +
            '}';
    }
}
